import {createRouter,createWebHashHistory} from 'vue-router'


//引入页面
const Home = ()=> import("@/views/Home.vue") 
const Cart = () => import("@/views/Cart.vue")
const Detail = ()=>import( "@/views/Detail.vue")
const Login = ()=>import( "@/views/Login.vue")
const My = ()=>import("@/views/My.vue")
const Register = ()=> import("@/views/Register.vue")

const routes = [
    {
        path:'/',
        redirect:'/Home'
    },
    {
        path:'/home',
        name:'Home',
        component:Home
    },
    {
        path:'/cart',
        name:'Cart',
        component: Cart
    },
    {
        path:'/login',
        name:'Login',
        component: Login
    },
    {
        path:'/detail',
        name:'Detail',
        component: Detail
    },
    {
        path:'/my',
        name:'My',
        component: My
    },
    {
        path: '/register',
        name: 'Register',
        component: Register
    },
]

//创建实例化router对象
    const router = createRouter({
        history:createWebHashHistory(),
        routes
    })

export default router